package com.jim.study.delicacy_bjx.dao;

import com.jim.study.delicacy_bjx.entity.Preference;
import com.jim.study.delicacy_bjx.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface UserMapper {

    User getUser(String username,String password);

    @Insert("insert into t_user value(#{id},#{username},#{password},#{sex},#{des})")
    int insertUser(User user);

    @Delete("delete from t_user where ID=#{id}")
    int deleteUserById(String id);

    @Update("update t_user set USERNAME=#{username},PASSWORD=#{password},SEX=#{sex},DES=#{des}")
    int updateUser(User user);

    List<Preference> getPreferenceByUsername(String username);

    int removePreferences(List<Preference> preferences);

    int insertPreference(List<Preference> preferences);
}
